<template>
  <view class="container">
    <view class="mian-container">
      <view class="header">
        <view class="main-title">{{ details.title }}</view>
        <view class="sub-title">
          <view class="column">所属栏目：<text>{{ details.columnTypeName }}</text></view>
          <view class="column">所属分类：<text>{{ details.publicizeTypeName }}</text></view>
        </view>
      </view>

      <u-parse :content="details.content"></u-parse>
      <template v-if="options.publicizeTypeName === '防骗'">
        <image class="antifraud-img" :src="baseImgUrl + 'antifraud.png'" :show-menu-by-longpress="'true'"></image>
        <view class="antifraud-text">
          保存图片到本地，使用微信或浏览器扫一扫，下载反诈APP
        </view>
      </template>
      <view class="footer">发布时间：{{ details.createTime }}</view>
    </view>
  </view>
</template>

<script>
  import {
    getAction
  } from "../utils/request.js";
  export default {
    data() {
      return {
        baseImgUrl: this.$baseImgUrl,
        imgPrefix: uni.getStorageSync("imgPrefix"),
        options: {},
        details: {},
      };
    },
    onLoad(options) {
      // JSON.parse(decodeURIComponent(options.data));
      this.options = options;
      this.getDetail();
    },
    onShow() {},
    methods: {
      async getDetail() {
        let {
          result
        } = await getAction("/mini/common/publicize_message/detail", {
          id: this.options.id,
        });
        this.details = result;
      },
    },
  };
</script>

<style lang="scss">
  .container {
    height: 100%;
    background: #f9f9f9 !important;
    padding: 10rpx 20rpx;

    .mian-container {
      background: #ffffff;
      border-radius: 8rpx;
      border: 1rpx solid #f1f1f1;
      padding: 40rpx 30rpx;

      .header {
        display: flex;
        flex-direction: column;
        align-items: center;

        margin-bottom: 30rpx;
        padding-bottom: 26rpx;
        border-bottom: 1rpx solid #e9e8e8;

        .main-title {
          font-size: 30rpx;
          font-family: PingFang SC, PingFang SC;
          font-weight: bold;
          color: #000000;
        }

        .sub-title {
          font-size: 24rpx;
          font-family: PingFang SC, PingFang SC;
          font-weight: 500;
          color: #999999;
          margin-top: 26rpx;
          display: flex;

          .column:nth-child(1) {
            margin-right: 70rpx;
          }
        }
      }

      .antifraud-img {
        width: 288rpx;
        height: 288rpx;
        margin: 0 auto;
        margin-bottom: 16rpx;
        display: block;
        margin-top: 34rpx;
      }

      .antifraud-text {
        font-weight: bold;
        font-size: 28rpx;
        line-height: 40rpx;
        text-align: center;
        width: 560rpx;
        margin: 0 auto;
      }

      .footer {
        height: 110rpx;
        line-height: 110rpx;
        text-align: center;
        border-top: 1rpx solid #e9e8e8;
        font-size: 26rpx;
        font-family: PingFang SC, PingFang SC;
        font-weight: 500;
        color: #999999;
        margin-top: 30rpx;
      }
    }
  }
</style>